import { Login } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import { obj2fd } from "@/utils/index";
import http from "@/api";
// 查询列表
export const getDataByPage = (params: object) => {
  return http.get<Login.ResLogin>(
    PORT1 +
      `/secure/warnList/${params.ip || " "}/${params.start_time || " "}/${params.end_time || " "}/${params.pageNum}/${params.pageSize}/last_time/desc`,
    {}
  ); // 正常 post json 请求  ==>  application/json
};
// 威胁名称列表
export const getThreatenName = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/threaName/1`); // 正常 post json 请求  ==>  application/json
};
// startcount
export const plugCountDate = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/plugCountDate`); // 正常 post json 请求  ==>  application/json
};
// endcount
export const warnCountDate = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/warnCountDate`); // 正常 post json 请求  ==>  application/json
};
// 处置威胁
export const warnAction = params => {
  return http.post<Login.ResLogin>(PORT1 + `/secure/warnAction`, obj2fd(params)); // 正常 post json 请求  ==>  application/json
};
// 处置威胁新增
export const warnAdd = params => {
  return http.post<Login.ResLogin>(PORT1 + `/secure/warnAdd`, params); // 正常 post json 请求  ==>  application/json
};
// 解封
export const plugAction = params => {
  return http.post<Login.ResLogin>(PORT1 + `/secure/plugAction`, obj2fd(params)); // 正常 post json 请求  ==>  application/json
};

// 手动封禁
export const plugOneKey = params => {
  return http.post<Login.ResLogin>(PORT1 + `/secure/plugOneKey`, obj2fd(params)); // 正常 post json 请求  ==>  application/json
};
// 封禁vlan列表
export const ifaceSentryVlanList = params => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/ifaceSentryVlanList/${params.id}`); // 正常 post json 请求  ==>  application/json
};
// 网口数据
export const ifaceTab = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/ifaceTab`); // 正常 post json 请求  ==>  application/json
};
// 解封
export const warnAddBatch = () => {
  return http.get<Login.ResLogin>(
    PORT1 + `/secure/warnAddBatch`,
    {},
    {
      noCheckCode: true
    }
  ); // 正常 post json 请求  ==>  application/json
};
// 解封
export const warnListSip = params => {
  return http.get<Login.ResLogin>(
    PORT1 +
      `/secure/warnListSip/${params.sip || "0"}/${params.start_time || "0"}/${params.end_time || "0"}/${params.threatId || "0"}/${params.pageNum}/${params.pageSize}`,
    obj2fd(params)
  ); // 正常 post json 请求  ==>  application/json
};
